var data = new window.XMLHttpRequest(),
	loadtext = document.getElementById('loadtext'),
	gettext = document.getElementById('gettext'),
	commontext = document.getElementById('common');

setInterval(function () {
	var nowDate = new Date();
	var nowH = nowDate.getHours();
	var nowM = nowDate.getMinutes();
	var nowS = nowDate.getSeconds();
	loadtext.innerHTML = nowH + ":" + nowM + ":" + nowS;
}, 1000);

data.open('GET', '../common/common.txt', true);
data.send(null);


var worker = new Worker('../js/worker.js');

function loadButton() {
	if (data.status == 200) {
		var str1 = parseInt(data.responseText, 10),
			str2 = parseInt(document.getElementById('inputNumber1').value, 10),
			str3 = parseInt(document.getElementById('inputNumber2').value, 10);

		commontext.value = str1;
		worker.postMessage(["num1", str1, str2, str3]);
		worker.onmessage = function (event) {
			gettext.innerHTML = event.data;
		};
	} else {
		alert("エラー");
	}
}

window.onload = function () {
}

worker.onerror = function (event) {
	console.log(event.message);
	console.log(event.filename);
	console.log(event.lineno);
};